﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="sendemail.aspx.cs" Inherits="sendemail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
        <title>发送邮件</title>
    <link href="Css/comm.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.2)" />
    <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.2)" />
    <script src="Js/JScript.js" type="text/javascript"></script>
    <script src="Js/ajaxrequest.js" type="text/javascript"></script>
</head>

<script>

var t_id = setInterval(animate,20);
var pos=0;var dir=2;var len=0;
function animate(){
}
function remove_loading() {
 this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display='none';
targelem.style.visibility='hidden';
}


document.writeln("<div id=loader_container>");
document.writeln("正在发送邮件,请稍后...");
document.writeln("</div>");


</script>





<body style="font-size:12px; margin:0; padding:0; padding-top:10px;" onload="remove_loading();">
    <form id="form1" runat="server">
        <div class="c_box_2" id="email_info">请稍后...</div>
        
        <div id="getdata" style="margin:3px; padding:3px; line-height:20px;"></div>
        <iframe scrolling=no id='zzej_window' src='' width='100%' height=140 border=0 style='broder:0px' frameborder=0></iframe>
    
        
        <script type="text/javascript">
        
        
        <%
        Response.Write("var qq='"+Semail+"';");
        Response.Write("var url='"+Surl+"';");
        Response.Write("var timeout='"+Stimeout+"';");
         %>
        if(qq!="")
        {
            var ArrQ=qq.split(",");
            var i=0;
            var timeS=setInterval("eventFun()",timeout);
            function eventFun()
            {
                if(ArrQ[i].length>5)
                {
                    document.all["zzej_window"].src="sendemail.aspx?email="+ArrQ[i];
                    var objs=document.all["email_info"];
                    
                    objs.innerHTML="正在为 <b color='#006600'>"+ArrQ[i]+"</b> 发送邮件...<br>";
                    objs.innerHTML+="发送邮件总数： <b color='#006600'>"+ArrQ.length+"</b>, 正在发送序数： <b color='#006600'>"+i+"</b><br>";
                    var si=((i/ArrQ.length)*100).toFixed(0)+" %";
                    var st=(ArrQ.length-i)*(timeout/1000);
                    objs.innerHTML+="发送进度：<b> "+si+" </b>  <font color=#999999>/</font>  剩余时间：<b> "+st+" </b>秒 <font color=#999999>/</font> 邮件发送时间间隔<b> "+ timeout/1000 +" </b>秒 <font color=#999999>/</font> 还剩<b> <span id='yu' style='color:#FF0000'>0</span> </b>秒发送下一封邮件.";
                    countDown(timeout/1000);
                    
                    
                    i++;
                }
                else
                {
                
                    setTimeout(function(){document.all["email_info"].innerHTML="邮件已成功发送完毕!<span id='yu' style='color:#FF0000'>0</span> </b>秒自动返回...";},2000);
                    
                    setTimeout(function(){parent.location.href=url},3000);
                    countDown(3000/1000);
                    window.clearInterval(timeS);
                
                }
                
                    
                    
            }
            
            function time_stop(){   
                  window.clearInterval("timeS");   
            } 
            
            function countDown(secs){
	            document.getElementById("yu").innerHTML=secs;
	            if(secs==1)
	                document.all["zzej_window"].src="";
	            
	            if(--secs>0) {
		            setTimeout("countDown("+secs+")",1000);
	            }
            }

            
            setTimeout("eventFun()",2000);
            
        }
        
        var ajax=new AJAXRequest();
        function getDataInfo()
        {
        $("getdata").innerHTML="正在更新数据库数据...";
        setTimeout(function(){ajax.get("getdata.aspx?act=getData",callGetDataInfo)},500);
        
        }
        
        function callGetDataInfo(obj)
        {
        var str=obj.responseText;
        $("getdata").innerHTML=str;
        }
        var timeData=setInterval("getDataInfo()",10000);
        getDataInfo();
        
        </script>
        
        
        
        
        
    
    </form>
</body>
</html>
